<%--
  Created by IntelliJ IDEA.
  User: dzh
  Date: 2021/5/23
  Time: 21:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Scope1</title>
</head>
<body>
<h1>Scope1页面</h1>
<%="this is scope1"%><br/>

<%
    pageContext.setAttribute("pageContext1", "pageContext");
    request.setAttribute("request1", "request");
    session.setAttribute("session1", "session");
    application.setAttribute("application1", "application");
%>
<%="pageContext域中存的值为" + pageContext.getAttribute("pageContext1")%><br/>
<%="request域中存的值为" + request.getAttribute("request1")%><br/>
<%="session域中存的值为" + session.getAttribute("session1")%><br/>
<%="application域中存的值为" + application.getAttribute("application1")%><br/>

<%
    //请求转发 http://localhost:8080/javaeestudy/scope1.jsp?isdispatcher=1
    if (request.getParameter("isdispatcher") != null && request.getParameter("isdispatcher").equalsIgnoreCase("1")) {
        request.getRequestDispatcher("/scope2.jsp").forward(request, response);
    }
%>
</body>
</html>
